package edu.neusoft.springhtmldemo.controller;

import edu.neusoft.springhtmldemo.domain.CameraManagement;
import edu.neusoft.springhtmldemo.service.CameraManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CameraManagementController {
    @Autowired
    private CameraManagementService service;

    @RequestMapping("showCameraManagement")
    public List<CameraManagement> showCameraManagement(){
        List<CameraManagement> lists=service.showAll();
//        for (CameraManagement list : lists) {
//            System.out.println(list);
//        }
        return lists;
    }

    @RequestMapping("updateCameraManagement")
    public void updateCameraManagement(CameraManagement cameraManagement){
        System.out.println(cameraManagement);
        service.updateCameraManagement(cameraManagement);
    }

    @RequestMapping("addCameraManagement")
    public void addCameraManagement(CameraManagement cameraManagement){
        service.addCameraManagement(cameraManagement);
    }

    @RequestMapping("delCameraManagement")
    public void delCameraManagement(Integer cameraID){
        service.delCameraManagement(cameraID);
    }

    @RequestMapping("selectCameraManagement")
    public List<CameraManagement> selectCameraManagement(String cameraID,String cameraIP,String userName,String pswd,String RTSPaddress){
        List<CameraManagement> lists=service.selectCameraManagement(cameraID,cameraIP,userName,pswd,RTSPaddress);
        return lists;
    }

    @RequestMapping("cameraIPValues")
    public List<String> cameraIPValues(){
        return service.cameraIPValues();
    }
}
